home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / uwsrc.arc / UW.H < prev    next >
Text File  |  1989-04-29  |  3KB  |  62 lines

  1. /*
  2.  *    uw command bytes
  3.  *
  4.  * Copyright 1985 by John D. Bruner.  All rights reserved.  Permission to
  5.  * copy this program is given provided that the copy is not sold and that
  6.  * this copyright notice is included.
  7.  *
  8.  *
  9.  * Two types of information are exchanged through the 7-bit serial line:
  10.  * ordinary data and command bytes.  Command bytes are preceeded by
  11.  * an IAC byte.  IAC bytes and literal XON/XOFF characters (those which
  12.  * are not used for flow control) are sent by a CB_FN_CTLCH command.
  13.  * Characters with the eighth bit set (the "meta" bit) are prefixed with
  14.  * a CB_FN_META function.
  15.  *
  16.  * The next most-significant bit in the byte specifies the sender and
  17.  * recipient of the command.  If this bit is clear (0), the command byte
  18.  * was sent from the host computer to the Macintosh; if it is set (1)
  19.  * the command byte was sent from the Macintosh to the host computer.
  20.  * This prevents confusion in the event that the host computer
  21.  * (incorrectly) echos a command back to the Macintosh.
  22.  *
  23.  * The remaining six bits are partitioned into two fields.  The low-order
  24.  * three bits specify a window number from 1-7 (window 0 is reserved for
  25.  * other uses) or another type of command-dependent parameter.  The next
  26.  * three bits specify the operation to be performed by the recipient of
  27.  * the command byte.
  28.  *
  29.  * Note that the choice of command bytes prevents the ASCII XON (021) and
  30.  * XOFF (023) characters from being sent as commands.  CB_FN_ISELW commands
  31.  * are only sent by the Macintosh (and thus are tagged with the CB_DIR_MTOH
  32.  * bit).  Since XON and XOFF data characters are handled via CB_FN_CTLCH,
  33.  * this allows them to be used for flow control purposes.
  34.  */
  35.  
  36. #define    IAC        0001        /* interpret as command */
  37. #define    CB_DIR        0100        /* command direction: */
  38. #define    CB_DIR_HTOM    0000        /*    from host to Mac */
  39. #define    CB_DIR_MTOH    0100        /*    from Mac to host */
  40. #define    CB_FN        0070        /* function code: */
  41. #define    CB_FN_NEWW    0000        /*    new window */
  42. #define    CB_FN_KILLW    0010        /*    kill (delete) window */
  43. #define    CB_FN_ISELW    0020        /*    select window for input */
  44. #define    CB_FN_OSELW    0030        /*    select window for output */
  45. #define    CB_FN_META    0050        /*    add meta to next data char */
  46. #define    CB_FN_CTLCH    0060        /*    low 3 bits specify char */
  47. #define    CB_FN_MAINT    0070        /*    maintenance functions */
  48. #define    CB_WINDOW    0007        /* window number mask */
  49. #define    CB_CC        0007        /* control character specifier: */
  50. #define    CB_CC_IAC    1        /*    IAC */
  51. #define    CB_CC_ON    2        /*    XON */
  52. #define    CB_CC_OFF    3        /*    XOFF */
  53. #define    CB_MF        0007        /* maintenance functions: */
  54. #define    CB_MF_ENTRY    0        /*    beginning execution */
  55. #define    CB_MF_EXIT    7        /*    execution terminating */
  56. #define    NWINDOW        7        /* maximum number of windows */
  57.  
  58. /* CB_CC_XON and CB_CC_XOFF give the same name on the DR C compiler.
  59.  * Changed them to CB_CC_ON and CB_CC_OFF
  60.  * hmm@unido
  61.  */
  62.